package Costar;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class MovieInfo {
    private String title;       //电影名称
    private int year;           //上映时间
    private String type;        //电影类型
    private float star;         //评分
    private String director;    //导演
    private String actor;       //演员
    private String time;        //时长
    private String film_page;   //链接

    public String toString() {
        return "MovieInfo [title=" + title + ", year=" + year + ", type=" + type + ", star=" + star + ", actor=" + actor + ", film_page=" + film_page + "]";
    }
    //反序列化方法：将可跨机器传输数据流（二进制串）转化为java对象的一种技术
    public void readFields(DataInput input) throws IOException {
        this.title = input.readUTF();
        this.year = input.readInt();
        this.type = input.readUTF();
        this.star = input.readFloat();
        this.director = input.readUTF();
        this.actor = input.readUTF();
        this.time = input.readUTF();
        this.film_page = input.readUTF();
    }
    //序列化方法：将java对象转化为可跨机器传输数据流（二进制串/字节）的一种技术
    public void write(DataOutput output) throws IOException {
        output.writeUTF(this.title);
        output.writeInt(this.year);
        output.writeUTF(this.type);
        output.writeFloat(this.star);
        output.writeUTF(this.director);
        output.writeUTF(this.actor);
        output.writeUTF(this.time);
        output.writeUTF(this.film_page);
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public int getYear() {
        return year;
    }
    public void setYear(int year) {
        this.year = year;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public float getStar() {
        return star;
    }
    public void setStar(float star) {
        this.star = star;
    }
    public String getDirector() {
        return director;
    }
    public void setDirector(String director) {
        this.director = director;
    }
    public String getActor() {
        return actor;
    }
    public void setActor(String actor) {
        this.actor = actor;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public String getFilm_page() {
        return film_page;
    }
    public void setFilm_page(String film_page) {
        this.film_page = film_page;
    }
}